/**
 * 
 */
package dms.repository;

import java.util.Date;
import java.util.List;

import dms.model.Building;
import dms.model.Dormitory;
import dms.model.form.Repair;
import dms.model.util.PageIterator;

/**
 * @author 李健
 *
 */
public interface RepairRepository {
	
	Repair findById(Long id);
	/**
	 * 查询某一楼栋里面一时间段的repair
	 * @param start
	 * @param count
	 * @param fromDate从某一时间 null表示不限制该时间
	 * @param toDate到某一时间 null表示不限制该时间
	 * @param building
	 * @return
	 */
/*	PageIterator<Repair> findByBuilding(int start, int count, Date fromDate, Date toDate, Building building);*/
	
//	PageIterator<Repair> findByDate(int start, int count, Date fromDate, Date toDate, Building building);
	
	/**
	 * 查询一时间段的已完成Repair
	 * @param start
	 * @param count
	 * @param fromDate从某一时间 null表示不限制该时间
	 * @param toDate到某一时间 null表示不限制该时间
	 * @param building
	 * @return
	 */
	PageIterator<Repair> findByStatus(int start, int count, Date fromDate, Date toDate, Boolean processed, Boolean applied);
	/**
	 * 查询一时间段的某寝室Repair
	 * @param start
	 * @param count
	 * @param fromDate从某一时间 null表示不限制该时间
	 * @param toDate到某一时间 null表示不限制该时间
	 * @param dormitory
	 * @return
	 */
	PageIterator<Repair> findByDormitory(int start, int count, Date fromDate, Date toDate, Dormitory dormitory, Boolean processed, Boolean applied);
	
	PageIterator<Repair> findByBuilding(int start, int count, Date fromDate, Date toDate, Building building, Boolean processed, Boolean applied);

	
	/**
	 * 
	 * @param repair
	 * @return
	 * @throws Exception
	 */
	Repair createRepair(Repair repair) throws Exception;
	
	Repair updateRepair(Repair repair) throws Exception;
	
	void deleteRepairById(Long id) throws Exception;
	
	void deleteRepairs(List<Long> ids) throws Exception;
}
